﻿using Common.Logging;
using Quartz;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YunSpace.Domain.IRepository.MiniSite;
using YunSpace.Repository.MiniSite;
using YunSpace.ThirdService;

namespace YunSpace.Services.Jobs.HiSpace
{
    /// <summary>
    /// 嗨空间场地（空间）短信计划任务
    /// </summary>
    public class HiSpaceSiteOrderSMSTodoJob : IJob
    {
        private static readonly ILog logger = LogManager.GetLogger(typeof(HiSpaceSiteOrderSMSTodoJob));

        public void Execute(IJobExecutionContext context)
        {
            try
            {
                ISiteOrderRepository service = new SiteOrderRepository();
                RongLianSmsManger smsManger = new RongLianSmsManger();

                //var minute = context.JobDetail.JobDataMap.GetIntValue("minute");
                //var daysNumber = context.JobDetail.JobDataMap.GetIntValue("daysNumber");


                //logger.InfoFormat("一、更新场地（空间）订单状态（0.未付订金; 1.已付订金; 2.等待确认;）为已超时（-1.未付订金超时;-2.已付订金超时;-3.等待确认超时;），返回状态为：{0}", result1);

                // 获取所有待发送短信计划（SiteOrder表中所有手机号码为11位的订单状态为0，2的状态）
                // 已发送短信表中未发送短信的计划的交计计划
                var phone = "";
                var siteName = "";
                var orderDate = DateTime.Now;

                smsManger.SendSiteOrderInfo(phone, siteName, orderDate);

            }
            catch (Exception ex)
            {
                logger.ErrorFormat("嗨空间场地（空间）短信计划任务：更新定时任务异常！原因：{0}", ex);
            }
        }
    }
}
